{template 'header', 'member'}
{if $is_company && !$_edittime}
	<div class="warn">贵公司尚未完善详细资料！完善的商业信息有助于获得别人的信任，结交潜在的商业伙伴，获取商业机会，请尽快完善</div>
{/if}
{if isset($success)}
	<div class="ok">资料保存成功，您可以：<a href="?action=index" class="b">继续完善</a> &nbsp;|&nbsp; <a href="{$DT[file_my]}" class="b">发布信息</a> &nbsp;|&nbsp; <a href="./" class="b">返回商务室首页</a></div>
{/if}
<div class="menu">
<table cellpadding="0" cellspacing="0">
<tr>
<td class="tab" id="Tab0"><a href="javascript:Tab(0);"><span>个人资料</span></a></td>
<td class="tab" id="Tab1"><a href="javascript:Tab(1);"><span>密码管理</span></a></td>
{if $is_company}
<td class="tab" id="Tab2"><a href="javascript:Tab(2);"><span>公司资料</span></a></td>
<td class="tab" id="Tab3"><a href="javascript:Tab(3);"><span>联系方式</span></a></td>
<td class="tab" id="Tab4"><a href="javascript:Tab(4);"><span>公司介绍</span></a></td>
{/if}
</tr>
</table>
</div>
<form method="post" action="?" onsubmit="return Dcheck();" id="dform">
<input type="hidden" name="tab" id="tab" value="{$tab}"/>
<table cellpadding="10" cellspacing="1" class="tb">
<tbody id="Tabs0" style="display:;">
<tr>
<td class="tl">会员名</td>
<td class="tr f_b">{$_username}</td>
</tr>
<tr>
<td class="tl">头像</td>
<td class="tr f_b"><a href="avatar.php"><img src="{useravatar($_username, 'large')}&reload={$DT_TIME}" width="128" height="128" title="点击修改"/></a></td>
</tr> 
<tr>
<td class="tl">昵称</td>
<td class="tr">{$_passport}{if $_passport == $_username}&nbsp;&nbsp;<a href="send.php?action=passport" class="b">[修改]</a>{/if}</td>
</tr>
<tr>
<td class="tl">邮件</td>
<td class="tr">{$_email}{if $vemail}&nbsp;&nbsp;<img src="image/v_email.gif" title="已认证" align="absmiddle"/>{/if}{if $DT[mail_type] != 'close'}&nbsp;&nbsp;<a href="send.php?action=email" class="b">[修改]</a>{/if}</td>
</tr>
{if $vmobile}
<tr>
<td class="tl">手机</td>
<td class="tr"><input type="hidden" name="post[mobile]" id="mobile" value="{$mobile}"/>{$mobile}&nbsp;&nbsp;<img src="image/v_mobile.gif" title="已认证" align="absmiddle"/>{if $DT[sms]}&nbsp;&nbsp;<a href="send.php?action=mobile" class="b">[修改]</a>{/if}</td>
</tr>
{else}
<tr>
<td class="tl">手机</td>
<td class="tr"><input type="text" size="20" name="post[mobile]" id="mobile" value="{$mobile}"/></td>
</tr>
{/if}
{if $vtruename}
<tr>
<td class="tl"><span class="f_red">*</span> 姓名</td>
<td class="tr"><input type="hidden" name="post[truename]" id="truename" value="{$truename}"/>{$truename}&nbsp;&nbsp;<img src="image/v_truename.gif" title="已认证" align="absmiddle"/></td>
</tr>
{else}
<tr>
<td class="tl"><span class="f_red">*</span> 姓名</td>
<td class="tr"><input type="text" size="10" name="post[truename]" id="truename" value="{$truename}"/>&nbsp;<span id="dtruename" class="f_red"></span></td>
</tr>
{/if}
<tr>
<td class="tl"><span class="f_red">*</span> 性别</td>
<td class="tr">
<input type="radio" name="post[gender]" value="1" {if $gender==1}checked="checked"{/if}/> 先生
<input type="radio" name="post[gender]" value="2" {if $gender==2}checked="checked"{/if}/> 女士
</td>
</tr>
{if !$is_company}
<tr>
<td class="tl"><span class="f_red">*</span> 地区</td>
<td class="tr">{ajax_area_select('post[areaid]', '请选择', $areaid)}&nbsp;<span id="dareaid" class="f_red"></span></td>
</tr>
<tr>
<td class="tl">地址</td>
<td class="tr"><input type="text" size="40" name="post[address]" id="daddress" value="{$address}"/>&nbsp;<span id="ddaddress" class="f_red"></span></td>
</tr>
<tr>
<td class="tl">邮编</td>
<td class="tr"><input type="text" size="8" name="post[postcode]" id="postalcode" value="{$postcode}"/></td>
</tr>
<tr>
<td class="tl">电话</td>
<td class="tr"><input type="text" size="20" name="post[telephone]" id="telephone" value="{$telephone}"/>&nbsp;<span id="dtelephone" class="f_red"></span></td>
</tr>
{/if}
<tr>
<td class="tl">部门</td>
<td class="tr"><input type="text" size="20" name="post[department]" id="department" value="{$department}"/></td>
</tr>
<tr>
<td class="tl">职位</td>
<td class="tr"><input type="text" size="20" name="post[career]" id="career" value="{$career}"/></td>
</tr>
{if $DT[im_qq]}
<tr>
<td class="tl">QQ</td>
<td class="tr"><input type="text" size="20" name="post[qq]" id="qq" value="{$qq}"/> 如果图标无法点亮，请点<a href="http://shang.qq.com/v3/widget.html" target="_blank" class="b">这里</a>设置</td>
</tr>
{/if}
{if $DT[im_wx]}
<tr>
<td class="tl">微信</td>
<td class="tr"><input type="text" size="20" name="post[wx]" id="wx" value="{$wx}"/></td>
</tr>
<tr>
<td class="tl">微信二维码</td>
<td class="tr"><input name="post[wxqr]" type="text" size="60" id="wxqr" value="{$wxqr}" readonly/>&nbsp;&nbsp;<span onclick="Dthumb({$moduleid},128,128, Dd('wxqr').value, true, 'wxqr');" class="jt">[上传]</span>&nbsp;&nbsp;<span onclick="_preview(Dd('wxqr').value);" class="jt">[预览]</span>&nbsp;&nbsp;<span onclick="Dd('wxqr').value='';" class="jt">[删除]</span></td>
</tr>
{/if}
{if $DT[im_ali]}
<tr>
<td class="tl">阿里旺旺</td>
<td class="tr"><input type="text" size="20" name="post[ali]" id="ali" value="{$ali}"/> 如果是淘宝旺旺，请填写TB:旺旺帐号，例如：TB:abcd，否则无法点亮</td>
</tr>
{/if}
{if $DT[im_skype]}
<tr>
<td class="tl">Skype</td>
<td class="tr"><input type="text" size="20" name="post[skype]" id="skype" value="{$skype}"/></td>
</tr>
{/if}
<tr>
<td class="tl">站内信提示音</td>
<td class="tr">
<div id="audition"></div>
<input type="radio" name="post[sound]" value="0" {if $sound==0}checked="checked"{/if} id="sound_0"/><label for="sound_0"> 无</label>&nbsp;&nbsp;
<input type="radio" name="post[sound]" value="1" {if $sound==1}checked="checked"{/if} id="sound_1"/> <a href="javascript:Inner('audition', sound('message_1'));Dd('sound_1').checked=true;void(0);" title="点击试听">提示音1</a>&nbsp;&nbsp;
<input type="radio" name="post[sound]" value="2" {if $sound==2}checked="checked"{/if} id="sound_2"/> <a href="javascript:Inner('audition', sound('message_2'));Dd('sound_2').checked=true;void(0);" title="点击试听">提示音2</a>&nbsp;&nbsp;
<input type="radio" name="post[sound]" value="3" {if $sound==3}checked="checked"{/if} id="sound_3"/> <a href="javascript:Inner('audition', sound('message_3'));Dd('sound_3').checked=true;void(0);" title="点击试听">提示音3</a>&nbsp;&nbsp;
</td>
</tr>
{if $MFD}{fields_html('<td class="tl">', '<td class="tr">', $user, $MFD)}{/if}
</tbody>
<tbody id="Tabs1" style="display:none;">
<tr>
<td class="tl">新登录密码</td>
<td class="tr"><input type="password" size="20" name="post[password]" id="password" onblur="validator('password');" autocomplete="off"/>&nbsp;<span class="f_gray">如不更改密码，请留空</span> <span id="dpassword" class="f_red"></span></td>
</tr>
<tr>
<td class="tl">重复登录密码</td>
<td class="tr"><input type="password" size="20" name="post[cpassword]" id="cpassword" autocomplete="off"/>&nbsp;<span id="dcpassword" class="f_red"></span></td>
</tr>
<tr>
<td class="tl">现有密码</td>
<td class="tr f_red"><input type="password" size="20" name="post[oldpassword]" id="oldpassword" autocomplete="off"/>&nbsp;如要更改密码，需输入现有密码 <span id="doldpassword" class="f_red"></span></td>
</tr>

<tr>
<td class="tl">新支付密码</td>
<td class="tr"><input type="password" size="20" name="post[payword]" id="payword" onblur="validator('payword');" autocomplete="off"/>&nbsp;<span class="f_gray">如不更改支付密码，请留空</span> <span id="dpayword" class="f_red"></span></td>
</tr>
<tr>
<td class="tl">重复支付密码</td>
<td class="tr"><input type="password" size="20" name="post[cpayword]" id="cpayword" autocomplete="off"/>&nbsp;<span id="dcpayword" class="f_red"></span></td>
</tr>
<tr>
<td class="tl">现有支付密码</td>
<td class="tr f_red"><input type="password" size="20" name="post[oldpayword]" id="oldpayword" autocomplete="off"/>&nbsp;支付密码默认和注册设置密码相同&nbsp;&nbsp;<a href="send.php" class="b">找回支付密码</a><span id="doldpayword" class="f_red"></span></td>
</tr>

</tbody>
{if $is_company}
<tbody id="Tabs2" style="display:none;">
<tr>
<td class="tl">公司名</td>
<td class="tr f_b">{$_company}</td>
</tr>
<tr>
<td class="tl"><span class="f_red">*</span>公司类型</td>
<td class="tr">{dselect($COM_TYPE, 'post[type]', '请选择', $type, 'id="type"', 0)}{if in_array('type', $_E)}&nbsp;{if isset($_U[type])}<span class="f_red">审核中</span>{else}<span class="f_gray">需审核</span>{/if}{/if}&nbsp;<span id="dtype" class="f_red"></span></td>
</tr>
<tr>
<td class="tl"><span class="f_red">*</span>所在地区</td>
<td class="tr">{ajax_area_select('post[areaid]', '请选择', $areaid)}{if in_array('areaid', $_E)}&nbsp;{if isset($_U[areaid])}<span class="f_red">审核中</span>{else}<span class="f_gray">需审核</span>{/if}{/if}&nbsp;<span id="dareaid" class="f_red"></span></td>
</tr>
<tr>
<td class="tl"><span class="f_red">*</span>主营行业</td>
<td class="tr">
<style type="text/css">
#cate-box {width:380px;margin-top:12px;background:#EEEEEE;padding:6px 12px;}
#cate-box div {height:24px;line-height:24px;overflow:hidden;}
#cate-box span {float:right;}
</style>
<div id="catesch"></div>
<span id="cate">{ajax_category_select('', '请选择行业', 0, 4)}</span> &nbsp; <a href="javascript:cate_add({$MOD[cate_max]});" class="b">添加</a>{if $DT[schcate_limit]} &nbsp; <a href="javascript:schcate(4);" class="b">搜索</a>{/if}
<div id="cate-box">
<div id="cate-tip"{if $cates}style="display:none;"{/if}>请添加主营行业，最多可添加 <strong class="f_red">{$MOD[cate_max]}</strong> 个</div>
{loop $cates $c}
<div id="cate-{$c}"><span><a href="javascript:cate_del({$c});" class="b">删除</a></span>{strip_tags(cat_pos(get_cat($c), '/'))}</div>
{/loop}
</div>
<input type="hidden" name="post[catid]" value="{$catid}" id="catid"/>
<span id="dcatid" class="f_red"></span>
</td>
</tr>
<tr>
<td class="tl"><span class="f_red">*</span>主营范围</td>
<td class="tr"><input type="text" size="80" name="post[business]" id="business" value="{$business}" maxlength="250"/>{if in_array('business', $_E)}&nbsp;{if isset($_U[business])}<span class="f_red">审核中</span>{else}<span class="f_gray">需审核</span>{/if}{/if}&nbsp;<span id="dbusiness" class="f_red"></span></td>
</tr>
<tr>
<td class="tl"><span class="f_red">*</span>成立年份</td>
<td class="tr"><input type="text" size="15" name="post[regyear]" id="regyear" value="{$regyear}" maxlength="4"/>{if in_array('regyear', $_E)}&nbsp;{if isset($_U[regyear])}<span class="f_red">审核中</span>{else}<span class="f_gray">需审核</span>{/if}{/if}&nbsp;<span id="dregyear" class="f_red"></span> <span class="f_gray">(年份，如：2004)</span></td>
</tr>
<tr>
<td class="tl">形象图片</td>
<td class="tr"><input name="post[thumb]" type="text" size="60" id="thumb" value="{$thumb}" readonly/>&nbsp;&nbsp;<span onclick="Dthumb({$moduleid},{$MOD[thumb_width]},{$MOD[thumb_height]}, Dd('thumb').value, true);" class="jt">[上传]</span>&nbsp;&nbsp;<span onclick="_preview(Dd('thumb').value);" class="jt">[预览]</span>&nbsp;&nbsp;<span onclick="Dd('thumb').value='';" class="jt">[删除]</span>
{if in_array('thumb', $_E)}&nbsp;{if isset($_U[thumb])}<span class="f_red">审核中</span>{else}<span class="f_gray">需审核</span>{/if}{/if}
<br/><span class="f_gray">建议使用LOGO、办公环境等标志性图片，最佳大小为{$MOD[thumb_width]}px*{$MOD[thumb_height]}px</span></td>
</tr>
<tr>
<td class="tl">经营模式</td>
<td class="tr">
<span id="com_mode">{$mode_check}</span> <span class="f_gray">(最多可选{$MOD[mode_max]}种)</span></td>
</tr>
<tr>
<td class="tl">公司规模</td>
<td class="tr">{dselect($COM_SIZE, 'post[size]', '请选择规模', $size, '', 0)}</td>
</tr>
<tr>
<td class="tl">注册资本</td>
<td class="tr">{dselect($MONEY_UNIT, 'post[regunit]', '', $regunit, '', 0)} <input type="text" size="6" name="post[capital]" id="capital" value="{$capital}"/> 万{if in_array('capital', $_E)}&nbsp;{if isset($_U[capital])}<span class="f_red">审核中</span>{else}<span class="f_gray">需审核</span>{/if}{/if}</td>
</tr>
<tr>
<td class="tl">销售的产品<br/>(提供的服务)</td>
<td class="tr"><input type="text" size="50" name="post[sell]" id="sell" value="{$sell}" maxlength="200"/> <span class="f_gray">多个产品或服务请用'|'号隔开</span></td>
</tr>
<tr>
<td class="tl">采购的产品<br/>(需要的服务)</td>
<td class="tr"><input type="text" size="50" name="post[buy]" id="buy" value="{$buy}" maxlength="200"/> <span class="f_gray">多个产品或服务请用'|'号隔开</span></td>
</tr>
{if $CFD}{fields_html('<td class="tl">', '<td class="tr">', $user, $CFD)}{/if}
</tbody>
<tbody id="Tabs3" style="display:none;">

<tr>
<td class="tl"><span class="f_red">*</span>公司地址</td>
<td class="tr"><input type="text" size="60" name="post[address]" id="daddress" value="{$address}" maxlength="200"/>{if in_array('address', $_E)}&nbsp;{if isset($_U[address])}<span class="f_red">审核中</span>{else}<span class="f_gray">需审核</span>{/if}{/if}&nbsp;<span id="ddaddress" class="f_red"></span></td>
</tr>

<tr>
<td class="tl">邮政编码</td>
<td class="tr"><input type="text" size="8" name="post[postcode]" id="postalcode" value="{$postcode}"/></td>
</tr>

<tr>
<td class="tl"><span class="f_red">*</span>公司电话</td>
<td class="tr"><input type="text" size="20" name="post[telephone]" id="telephone" value="{$telephone}"/>{if in_array('telephone', $_E)}&nbsp;{if isset($_U[telephone])}<span class="f_red">审核中</span>{else}<span class="f_gray">需审核</span>{/if}{/if}&nbsp;<span id="dtelephone" class="f_red"></span></td>
</tr>
<tr>
<td class="tl">公司传真</td>
<td class="tr"><input type="text" size="20" name="post[fax]" id="fax" value="{$fax}"/></td>
</tr>
<tr>
<td class="tl">公司邮件</td>
<td class="tr"><input type="text" size="30" name="post[mail]" id="mail" value="{$mail}"/> <span class="f_gray">[公开]</span></td>
</tr>
<tr>
<td class="tl">公司网址</td>
<td class="tr"><input type="text" size="30" name="post[homepage]" id="homepage" value="{$homepage}"/></td>
</tr>
<tr>
<td class="tl">微信公众号</td>
<td class="tr"><input type="text" size="20" name="post[gzh]" id="gzh" value="{$gzh}"/>{if in_array('gzh', $_E)}&nbsp;{if isset($_U[gzh])}<span class="f_red">审核中</span>{else}<span class="f_gray">需审核</span>{/if}{/if}</td>
</tr>
<tr>
<td class="tl">公众号二维码</td>
<td class="tr"><input name="post[gzhqr]" type="text" size="60" id="gzhqr" value="{$gzhqr}" readonly/>&nbsp;&nbsp;<span onclick="Dthumb({$moduleid}, 128, 128, {if in_array('gzhqr', $_E)}''{else}Dd('gzhqr').value{/if}, true, 'gzhqr');" class="jt">[上传]</span>&nbsp;&nbsp;<span onclick="_preview(Dd('gzhqr').value);" class="jt">[预览]</span>&nbsp;&nbsp;<span onclick="Dd('gzhqr').value='';" class="jt">[删除]</span>
{if in_array('gzhqr', $_E)}&nbsp;{if isset($_U[gzhqr])}<span class="f_red">审核中</span>{else}<span class="f_gray">需审核</span>{/if}{/if}</td>
</tr>
</tbody>
<tbody id="Tabs4" style="display:none;">
<tr>
<td class="tl"><span class="f_red">*</span>公司介绍</td>
<td class="tr"><textarea name="post[content]" id="content" class="dsn">{$content}</textarea>
{deditor($moduleid, 'content', $group_editor, '95%', 300)}<br/>
{if in_array('content', $_E)}{if isset($_U[content])}<span class="f_red">审核中</span>{else}<span class="f_gray">需审核</span>{/if}&nbsp;{/if}<span id="dcontent" class="f_red"></span></td>
</tr>
</tbody>
{/if}
{if $need_captcha}
<tr>
<td class="tl"><span class="f_red">*</span> 验证码</td>
<td class="tr">{template 'captcha', 'chip'} <span id="dcaptcha" class="f_red"></span></td>
</tr>
{/if}
<tr>
<td class="tl">&nbsp;</td>
<td class="tr" height="30"><input type="submit" name="submit" value=" 保 存 " class="btn_g"/></td>
</tr>
</table>
</form>
<script type="text/javascript">
s('edit');
{if $tab}
Tab({$tab});
{else}
m('Tab0');
{/if}
</script>
{load('clear.js')}
<script type="text/javascript">
function check_mode(c, m) {
	if($('#com_mode input:checkbox:checked').length > m) {confirm('最多可选'+m+'种经营模式'); c.checked = false;}
}
function cate_del(id) {
	$('#cate-'+id).remove();
	var cids = $('#catid').val().replace(','+id+',', ',');
	$('#catid').val(cids);
	if($('#cate-box').html().indexOf('span') == -1) {
		$('#cate-tip').show();
	} else {
		$('#cate-tip').hide();
	}
}
function cate_add(max) {
	if($('#cate-box div').length > max) {
		Dmsg('最多可以添加'+max+'个行业', 'catid');
		return;
	}
	var cid = $('#catid_1').val();
	if(cid == 0) {
		Dmsg('请选择行业', 'catid');
		return;
	}
	if($('#cate-box').html().indexOf('cate-'+cid) != -1) {
		Dmsg('所选行业已经存在', 'catid');
		return;
	}
	var str = '';
	$('#cate option:selected').each(function() {
		if($(this).val()) str += $(this).text()+'/';
	});
	if(str) {
		str = str.replace('&amp;', '&');
		str = str.replace('请选择行业/', '');
		str = str.substring(0, str.length-1);
		$('#cate-box').append('<div id="cate-'+cid+'"><span><a href="javascript:cate_del('+cid+');" class="b">删除</a></span>'+str+'</div>');
		var cids = $('#catid').val() ? $('#catid').val() +cid+',' : ','+cid+',';
		$('#catid').val(cids);
		$('#cate-tip').hide();
	} else {
		Dmsg('请选择行业', 'catid');
	}
}
var vid = '';
function validator(id) {
	if(!Dd(id).value) return false;
	vid = id;
	$.post(AJPath, 'moduleid={$moduleid}&action=member&job='+id+'&value='+Dd(id).value+'&userid={$userid}', function(data) {
		Dd('d'+vid).innerHTML = data ? data : '';
	});
}
function Dcheck() {
	if(Dd('truename').value == '') {
		Tab(0);
		Dmsg('请填写真实姓名', 'truename');
		return false;
	}
	if(Dd('password').value.length > 5) {
		if(Dd('cpassword').value == '') {
			Tab(1);
			Dmsg('请重复输入密码', 'cpassword');
			return false;
		}
		if(Dd('password').value != Dd('cpassword').value) {
			Tab(1);
			Dmsg('两次输入的密码不一致', 'password');
			return false;
		}
		if(Dd('oldpassword').value.length < 6) {
			Tab(1);
			Dmsg('请输入密码', 'oldpassword');
			return false;
		}
	}
	if(Dd('payword').value.length > 5) {
		if(Dd('cpayword').value == '') {
			Tab(1);
			Dmsg('请重复输入支付密码', 'cpayword');
			return false;
		}
		if(Dd('payword').value != Dd('cpayword').value) {
			Tab(1);
			Dmsg('两次输入的支付密码不一致', 'payword');
			return false;
		}
		if(Dd('oldpayword').value.length < 6) {
			Tab(1);
			Dmsg('请输入支付密码', 'oldpayword');
			return false;
		}
	}

{if !$is_company}	
	if(Dd('areaid_1').value == 0) {
		Tab(0);
		Dmsg('请选择地区', 'areaid');
		return false;
	}
{/if}

	{if $MFD}{fields_js($MFD)}{/if}
	{if $is_company}
	{if $CFD}{fields_js($CFD)}{/if}
	if(Dd('type').value == '') {
		Tab(2);
		Dmsg('请选择公司类型', 'type');
		return false;
	}
	if(Dd('areaid_1').value == 0) {
		Tab(2);
		Dmsg('请选择公司所在地', 'areaid');
		return false;
	}
	if(Dd('catid').value.length < 2) {
		Tab(2);
		Dmsg('请选择公司主营行业', 'catid');
		return false;
	}
	if(Dd('business').value.length < 4) {
		Tab(2);
		Dmsg('主要经营范围最少3字', 'business');
		return false;
	}
	if(Dd('regyear').value.length < 4) {
		Tab(2);
		Dmsg('请填写公司成立年份', 'regyear');
		return false;
	}
	if(Dd('daddress').value.length < 5) {
		Tab(3);
		Dmsg('请填写公司地址', 'daddress');
		return false;
	}
	if(Dd('telephone').value.length < 6) {
		Tab(3);
		Dmsg('请填写公司电话', 'telephone');
		return false;
	}
	if(FCKLen('content') < 10) {
		Tab(4);
		Dmsg('公司介绍最少10字，当前已经输入'+FCKLen('content')+'字', 'content');
		return false;
	}
	{/if}	
{if $need_captcha}
	f = 'captcha';
	if($('#c'+f).html().indexOf('ok.png') == -1) {
		Dmsg('请填写正确的验证码', f);
		return false;
	}
{/if}
	return true;
}
</script>
{template 'footer',$module}